/*Name: elgamal.h
  Last Modification: 12/06/10 23:12
  Description: Header de la classe elgamal. Cet algorithme utilise les propriétées des nombres
  premiers pour assurer la sécurité du cryptosystéme.Assez peu connu il reste pourtant très intéressant
  car pour un meme texte et des meme clefs, on peut avoir des codés différents ce qui permet de donner
  encore moins d'information aux personnes extérieurs.
  License: GNU GPL v3
    Copyright (C) 2012 G. Bonnoron, P.Brunet, C. Duchene et F. Cornevaux-Juignet

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.*/

#ifndef ELGAMAL_H
#define ELGAMAL_H

#include<QWidget>
#include<QString>
#include<QByteArray>
#include<QTime>
#include<QPushButton>
#include<QLineEdit>
#include<QTextEdit>
#include<QFormLayout>
#include<QGroupBox>
#include<QFile>
#include<QProgressBar>
#include<QLabel>
#include <QCheckBox>
#include<gmp.h>
#include<gmpxx.h>
#include"elgamal_global.h"
#include"../../algorithme.h"

class Elgamal : public Algorithme
{
public:
    Elgamal();
    void chiffre(bool fich);
    void dechiffre(bool fich);
    QList<QWidget*> affiche();
     Algorithme* maker();
    ~Elgamal();
    char hexa(long);
    QString aide();
    QString nom();
public slots:
    void newKey();
    void initialisation();
    void save();
private:
    void outElgamal(bool fichier);
    void generer(bool crypt);
    void generercle();
    mpz_class p, q, g, x, h;
    QPushButton *bouton;
    QLineEdit *cleg, *cleh, *cleq, *clex, *clefichier, *clefichier2;
    QLabel *texte0, *texte1, *texte2, *label_h, *label_q, *label_g, *label_x;
    QTextEdit *crypter;
    QVBoxLayout *corps;
    QWidget *fenetre;
    QProgressBar * barre;
    QCheckBox * coche;
  };

#endif // ELGAMAL_H
